﻿@model IEnumerable<Tecnosop.Dominio.CLIENTE>
@{
    ViewBag.Title = "Ver todos los clientes";
    Layout = "~/Views/Cliente/_LayoutCliente.cshtml";
}
<fieldset>
<legend>Lista de clientes</legend>
    <br />
    @(Html.Telerik().Grid(Model)
        .Name("Clientes")
        .DataKeys(keys => keys.Add(k => k.RUT_CLIENTE))
        .DataBinding(dataBinding => dataBinding.Server()
            .Delete(MVC.Cliente.Delete().GetRouteValueDictionary()))
        .Columns(columuns =>
            {
                columuns.Bound(c => c.RUT_CLIENTE)
                    .Format(Html.ActionLink("{0}", MVC.Cliente.Details("{0}")).ToString())
                    .Encoded(false)
                    .Width(150);
                columuns.Bound(c => c.NOMBRE);
                columuns.Bound(c => c.DIRECCION);
                columuns.Bound(c => c.EMAIL);
@*                columuns.Template(
                    @<text>
                        @Html.ActionLink("Editar", MVC.Cliente.Edit(item.RUT_CLIENTE), new { @class = "nice radius thin white button" })
                    </text>).Width(60);*@
                columuns.Command(cmd =>
                    {
                        cmd.Custom("Editar")
                            .Text("Editar")
                            .Ajax(false)
                            .ButtonType(GridButtonType.ImageAndText)
                            .ImageHtmlAttributes(new { @class = "t-icon t-edit" })
                            .HtmlAttributes(new { @class = "nice radius verysmall white button" })
                            .Action(MVC.Cliente.ActionNames.Edit, MVC.Cliente.Name);
                        cmd.Delete()
                            .ButtonType(GridButtonType.ImageAndText)
                            .HtmlAttributes(new { @class = "nice radius verysmall red button" });
                    }).Width(170);
            })
        .Selectable()
        //.ClientEvents(events => events.OnRowSelect("onRowSelect"))
        .Pageable(paging => paging.PageSize(10))
        .Scrollable(scrolling => scrolling.Enabled(false))
        .PrefixUrlParameters(false)
        .Sortable()
        .Filterable()
        )
</fieldset>